<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var x = window.prompt("请输入行数，生成相应行数的三角形和平行四边形","整数")
        alert(x);
        document.write("三角形:\n");
        for(var i=1;i<=x;i++){
            for(j=1;j<=x-i;j++){
                document.write('&nbsp;');
            }
            for(var k=1;k<+2*i-1;k++){
                document.write('*');
            }
            document.write('<br>');
        }
        document.write("平行四边形\n");
        for(var i=1;i<=x;i++){
            document.write("<br>");
            for(var j=1;j<=i-1;j++){
                document.write("&nbsp;");
            }
            for(var k=1;k<=x;k++){
                document.write("*");
            }
        }
    </script>
</body>
</html>